<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/validation.jsp"%>
<%@ include file="/commons/dateTime.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="${ctx }/scripts/public3.js"></script>
<script type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>

<title>违规登记 ${isReinspection }</title>
<script type="text/javascript">
	function hasCheck(){

		var inputArray = document.getElementsByTagName("input");
		var hasChecked = 0;
		for(var i=0; i < inputArray.length;i++){

			if(inputArray[i].type=='checkbox'){
				if(inputArray[i].checked) hasChecked++;
			}
		}
		if(hasChecked > 0){
			Validation.removeElmValidate('stopBehaviorYn');
			return true;
		}
		else{
			validationAlert('stopBehaviorYn',true,"左边的至少选择一个");
			return false;
		}
	}

	
	function checkState(){
		if($('amerceYn').checked == true){
			$('amerceClient').disabled = '';
			$('amerceCompany').disabled = '';
		}
		else{
			$('amerceClient').disabled = 'disabled';
			$('amerceCompany').disabled = 'disabled';
			
		}


		if($('termReformYn').checked == true){
			$('reformDate').disabled = '';
		}else{
			$('reformDate').disabled= 'disabled';
		}

		
		if($('seizureYn').checked == true){
			$('seizureRes').disabled= '';
		}else{
			$('seizureRes').disabled= 'disabled';
		}


		if($('otherYn').checked == true){
			$('otherRemark').disabled= '';
		}else{
			$('otherRemark').disabled= 'disabled';
		}
	}

	function submitFun(){
		var isPass=$('inspection').fireEvent("onSubmit");
		if(isPass && hasCheck()){
			closeORopenButton();
			var param = Form.serialize('inspection');
			var url = '${ctx}/renovation_firstInspectionAction.do?method=addInspectionViolation';
			new Ajax.Request(url,{method: 'post',parameters :param ,onSuccess : function(response){
				closeORopenButton();
	            ajaxSubmitException(response.responseText);
	      		if("true" == response.responseText){
		       		//var obj=findFrame('ReinspectionListIForm');
		       		//obj.parent.refresh();
		       		windowClose();
		        }
			}});
		}
	}

	function renovateTypeAlter(typeName){ //改变时必填样式改变

		if (typeName == "ourself_radio"){
			$('remarktd').className="aux_intable_td2";

			Validation.removeElmValidate('remark');

		}else{

			$('remarktd').className="aux_intable_require_more";
			$('remark').className="textareatext  validate-char";

		}
	}

	function closeORopenButton(){
		$('btn1_22').disabled= !$('btn1_22').disabled;
	}
</script>
</head>
<body onload="checkState();">
<form name="inspection" id="inspection" action="" method="post"
	class="required-validate"><c:if test="${isReinspection=='1' }">
	<input type="hidden" id="reinspectionId" name="reinspectionId"
		value="${inspectionId }" />
</c:if> <c:if test="${isReinspection!='1' }">
	<input type="hidden" id="firstInspectionId" name="firstInspectionId"
		value="${inspectionId }" />
</c:if> <input type="hidden" id="keyword" name="keyword"
	value="${inspectionViolationVO.keyword }" /> <input type="hidden"
	id="inspectionRequisitionId" name="inspectionRequisitionId"
	value="${inspectionRequisitionId }" /> <input type="hidden"
	id="nowDate" name="nowDate" value="${nowDate }" />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="window_head_outBg">
		<table border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td><img src="${ctx}/images/ico_Advance.gif" width="16"
					height="16" align="absmiddle" /> <span class="window_head_intext">违规登记</span></td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="aux_header_line_1"></td>
	</tr>
	<tr>
		<td class="aux_header_line_2"></td>
	</tr>
	<tr>
		<td class="content">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td valign="top" class="aux_outtable_color">
				<table width="100%" border="0" cellpadding="0" cellspacing="1"
					class="aux_intable_color">
					<tr>
						<td class="aux_intable_td1">房 号：</td>
						<td class="aux_intable_td2">${inspectionRequisitionVO.houseNumber
						}</td>
						<td class="aux_intable_td1">业主姓名：</td>
						<td class="aux_intable_td2">${inspectionRequisitionVO.clientNames
						}</td>
					</tr>
					<tr>
						<td class="aux_intable_td1">装修许可证号：</td>
						<td class="aux_intable_td2">${inspectionRequisitionVO.renovateLicence
						}</td>
						<td class="aux_intable_td1">装修承建商：</td>
						<td class="aux_intable_td2" id="companyName">${inspectionRequisitionVO.companyName
						}&nbsp;</td>
					</tr>
					<tr>
						<td class="aux_intable_td1">装修联系人：</td>
						<td class="aux_intable_td2">${inspectionRequisitionVO.linkMan
						}</td>
						<td class="aux_intable_td1">联系电话：</td>
						<td class="aux_intable_td2"><input name="linkManPhone"
							id="linkManPhone" type="text" class="inputtext"
							value="${inspectionRequisitionVO.linkManPhone }" size="16"
							maxlength="30" /></td>
					</tr>
					<tr>
						<td class="aux_intable_td1">现场负责人：</td>
						<td class="aux_intable_td2">${inspectionRequisitionVO.burdenMan
						}</td>
						<td class="aux_intable_td1">联系电话：</td>
						<td class="aux_intable_td2"><input name="burdenManPhone"
							id="burdenManPhone" type="text" class="inputtext"
							value="${inspectionRequisitionVO.burdenManPhone }" size="16"
							maxlength="30" /></td>
					</tr>
					<tr>
						<td class="aux_intable_td1">检查人：</td>
						<td class="aux_intable_require"><input name="checkMan"
							id="checkMan" type="text" class="inputtext required"
							value="${inspectionViolationVO.checkMan }" size="16"
							maxlength="36" /></td>
						<td class="aux_intable_td1">检查日期：</td>
						<td class="aux_intable_require">
						<table border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td><input name="checkDate" id="checkDate" type="text"
									class="inputtext validate-date-yyyy-mm-dd less-equals-than-nowDate great-equals-than-violateDate"
									validateMessage="输入的检查日期必须小于等于当前系统时间,并且不能小于违规日期"
									value="${inspectionViolationVO.checkDate }"
									afterInsert="checkDateAfter" size="16" /></td>
								<td width="4">&nbsp;</td>
								<td><img id="checkDateImg"
									src="${ctx}/images/ico_clock_month.gif" width="20" height="20" /><span
									id="checkDateAfter"></span></td>
							</tr>
						</table>
						</td>
					</tr>
					<tr>
						<td class="aux_intable_td1">违规日期：</td>
						<td class="aux_intable_require">
						<table border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td><input name="violateDate" id="violateDate"
									validateMessage="输入的违规日期必须小等于当前系统时间,并且不能大于检查日期" type="text"
									class="inputtext required validate-date-yyyy-mm-dd less-equals-than-nowDate less-equals-than-checkDate"
									value="${inspectionViolationVO.violateDate }"
									afterInsert="violateDateAfter" size="16" /></td>
								<td width="4">&nbsp;</td>
								<td><img id="violateDateImg"
									src="${ctx}/images/ico_clock_month.gif" width="20" height="20" /><span
									id="violateDateAfter"></span></td>
							</tr>
						</table>
						</td>
						<td class="aux_intable_td1">整改完成日期：</td>
						<td class="aux_intable_require">
						<table border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td><input name="completeDate" type="text"
									class="inputtext required validate-date-yyyy-MM-dd great-equals-than-nowDate"
									validateMessage="输入的日期必须大于等于当前系统时间"
									value="<fmt:formatDate value="${inspectionViolationVO.completeDate }" pattern="yyyy-MM-dd"/>"
									size="16" afterInsert="completeDateAfter" maxlength="10" /></td>
								<td width="4">&nbsp;</td>
								<td><img name="completeDateButton"
									src="${ctx}/images/ico_clock_month.gif" width="20" height="20" /><span
									id="completeDateAfter"></span></td>
							</tr>
						</table>
						</td>
					</tr>
					<tr>
						<td height="58" valign="top" class="aux_intable_td1">违规行为描述：</td>
						<td colspan="3" class="aux_intable_require_more"><textarea
							name="description" id="description" cols="40" rows="3"
							class="required max-length-100">${inspectionViolationVO.description }</textarea></td>
					</tr>
					<tr>
						<td rowspan="6" valign="top" class="aux_intable_td1">处理结果：</td>
						<td colspan="3" class="aux_intable_require_more">
						<table border="0" cellspacing="2" cellpadding="2">
							<tr>
								<td>
								<table border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td><input name="stopBehaviorYn" class="" type="checkbox"
											<c:if test="${inspectionViolationVO.stopBehaviorYn == '1' }">checked="checked"</c:if>
											value="1" /></td>
										<td width="4">&nbsp;</td>
										<td>请立即停止上述行为</td>
									</tr>
								</table>
								</td>
							</tr>
							<tr>
								<td colspan="3">
								<table border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td><input type="checkbox" name="stopRenovateYn"
											<c:if test="${inspectionViolationVO.stopRenovateYn == '1' }">checked="checked"</c:if>
											value="1" /></td>
										<td width="4">&nbsp;</td>
										<td>请立即停止全部装修工程</td>
									</tr>
								</table>
								</td>
							</tr>
							<tr>
								<td colspan="3">
								<table border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td><input name="termReformYn" onclick="checkState();"
											type="checkbox"
											<c:if test="${inspectionViolationVO.termReformYn == '1' }">checked="checked"</c:if>
											value="1" /></td>
										<td width="4">&nbsp;</td>
										<td>期限于</td>
										<td width="4">&nbsp;</td>
										<td><input name="reformDate" id="reformDate" type="text"
											class="inputtext validate-date-yyyy-mm-dd"
											value="${inspectionViolationVO.reformDate }"
											afterInsert="reformDateAfter" size="16" /></td>
										<td width="4">&nbsp;</td>
										<td><a href="#"><img id="reformDateImg"
											src="${ctx}/images/ico_clock_month.gif" alt="请点选查找日期"
											border="0" /></a><span id="reformDateAfter"></span></td>
										<td width="4">&nbsp;</td>
										<td>恢复或处理好</td>
									</tr>
								</table>
								</td>
							</tr>
							<tr>
								<td colspan="3">
								<table border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td><input id="amerceYn" onclick="checkState();"
											type="checkbox"
											<c:if test="${inspectionViolationVO.amerceYn == '1' }">checked="checked"</c:if>
											name="amerceYn" value="1" /></td>
										<td width="4">&nbsp;</td>
										<td>罚款：业主</td>
										<td width="4">&nbsp;</td>
										<td><input name="amerceClient" id="amerceClient"
											value="${inspectionViolationVO.amerceClient }" type="text"
											class="inputtext" style="text-align: right" size="16" /></td>
										<td width="4">&nbsp;</td>
										<td>元(人民币)，装修公司</td>
										<td width="4">&nbsp;</td>
										<td><input name="amerceCompany" id="amerceCompany"
											value="${inspectionViolationVO.amerceCompany }" type="text"
											class="inputtext" style="text-align: right" size="16" /></td>
										<td width="4">&nbsp;</td>
										<td>元(人民币)</td>
									</tr>
								</table>
								</td>
							</tr>
							<tr>
								<td colspan="3">
								<table border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td><input type="checkbox" onclick="checkState();"
											id="seizureYn" name="seizureYn"
											<c:if test="${inspectionViolationVO.seizureYn == '1' }">checked="checked"</c:if>
											value="1" /></td>
										<td width="4">&nbsp;</td>
										<td>没收</td>
										<td width="4">&nbsp;</td>
										<td><input name="seizureRes" id="seizureRes" type="text"
											value="${inspectionViolationVO.seizureRes }"
											class="inputtext" size="26" /></td>
									</tr>
								</table>
								</td>
							</tr>
							<tr>
								<td colspan="3">
								<table border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td><input type="checkbox" onclick="checkState();"
											<c:if test="${inspectionViolationVO.otherYn == '1' }">checked="checked"</c:if>
											name="otherYn" id="otherYn" value="1" /></td>
										<td width="4">&nbsp;</td>
										<td>其他</td>
										<td width="4">&nbsp;</td>
										<td><input name="otherRemark" id="otherRemark"
											type="text" value="${inspectionViolationVO.otherRemark }"
											class="inputtext" size="26" /></td>
									</tr>
								</table>
								</td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="window_footer">
		<table border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td class="buttonOffLeft" id="btn1_21"></td>
						<td class="buttonOffMiddle" id="btn1_22"
							onClick="javascript:submitFun();"
							onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)"
							onblur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif"
							alt="" width="14" height="14" border="0" align="absbottom" /> 保
						存</td>
						<td class="buttonOffRight" id="btn1_23"></td>
					</tr>
				</table>
				</td>
				<td class="btn_between_space"></td>
				<td>
				<table border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td class="buttonOffLeft" id="btn1_31"></td>
						<td class="buttonOffMiddle" id="btn1_32"
							onClick="javascript:windowClose();"
							onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)"
							onblur="btn_change(3)"><img
							src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14"
							border="0" align="absbottom" /> 关 闭</td>
						<td class="buttonOffRight" id="btn1_33"></td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</form>
<script type="text/javascript">
             Calendar.setup(
              {
	              inputField : "reformDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "reformDateImg", // ID of the button
	             // align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
             Calendar.setup(
                     {
       	              inputField : "violateDate", // ID of the input field
       	              ifFormat : "%Y-%m-%d", // the date format
       	              button : "violateDateImg", // ID of the button
       	             // align          :    "Tl",           // alignment (defaults to "Bl")
       			      singleClick    :    true
                     }
                     );
             Calendar.setup(
                     {
       	              inputField : "checkDate", // ID of the input field
       	              ifFormat : "%Y-%m-%d", // the date format
       	              button : "checkDateImg", // ID of the button
       	             // align          :    "Tl",           // alignment (defaults to "Bl")
       			      singleClick    :    true
                     }
                     );
             Calendar.setup(
              {
	              inputField : "completeDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "completeDateButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
             </script>
</body>
</html>